<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ include file="pub/top_list2.jsp"%>   
<%
String userid = (String) request.getSession().getAttribute("name");
String gimg=null;
String gname=null;
int productid=0;
BigDecimal maxprice=new BigDecimal("0.00");
BigDecimal minprice= new BigDecimal("0.00");
String[] params = new String[1];
params[0] =userid;
String sql = "select a.*,b.gimg,b.othername from mycollect a,goodinfo b where a.userid=? and a.productid=b.productid order by jiarudate desc";
List<Map<String, Object>> list= db.queryList(sql, params);
//System.out.println(list);

%>
 <script type="text/javascript">
    	function mycheck(val)
		{
			if($("#collect"+val).is(':checked'))
			{
				$(".label"+val).addClass("collectd");
				$(".collectbox").fadeIn(300)
				$(".kong").fadeIn()
			}
			else
			{
				$(".label"+val).removeClass("collectd");
				$(".collectbox").fadeOut(300)
				$(".kong").fadeOut()
			}
		}
    	
    </script>
<body>
	<header class="top-header fixed-header">
		<a class="icona" href="javascript:history.go(-1)">
				<img src="images/left.png"/>
			</a>
		<h3>我的收藏</h3>
		<!-- 	
			<a class="text-top">
				编辑
			</a> -->
	</header>
	
	<div class="contaniner fixed-conta">
		<div style="margin-top: 3%;"></div>
		<section class="list">
			<ul class="wall">
			 <%
	   
	    for (Map<String, Object> m : list) {
	    	gname=(String)m.get("othername");
	    	gimg=(String)m.get("gimg");
	    	productid=(Integer)m.get("productid");
	    	MyDB db3 = My.getDb1();
	    	String sql3="select max(oprice) as maxprice,min(oprice) as minprice from goodjiage where goodsxid in(select goodsxid from goodsx where productid=?)";
	    	Object[] params1 = new Object[1];
	    	params1[0] =productid;
	    	Map<String, Object> op= db3.queryMap(sql3, params1);
	    	maxprice=new BigDecimal(op.get("maxprice").toString()).setScale(2, BigDecimal.ROUND_HALF_UP);
	    			
	    	minprice=new BigDecimal(op.get("minprice").toString()).setScale(2, BigDecimal.ROUND_HALF_UP);
	    
	    %>
				<li class="pic">
					<a href="detail.jsp">
						<img src="<%=gimg %>"/>
						<p><%=gname %></p>
						<b class="oprice" id="oprice" value="">
				<%if(minprice.compareTo(maxprice)==0) {%>
					<%=minprice %>
				<%}else{ %>
					<%=minprice %>-<%=maxprice %>
				<%} %>
				</b>
						<div class="collectbar">
							<label for="collect1"  onselectstart="return false" class="label1"></label>
							<input type="checkbox" onclick="mycheck(1)" id="collect1"/>
						</div>
					</a>
				</li>
				<%} %> 
				
			</ul>
		</section>
		<div class="kong" style="margin-bottom: 16%;"></div>
	</div>
	
<footer class="collectbox fixed-footer">
	
	<input type="button" value="确认删除" />
</footer>

	
	

</body>
</html>